<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>embedme: Semaphore类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">embedme
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.8 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li class="current"><a href="annotated.html"><span>类</span></a></li>
      <li><a href="files.html"><span>文件</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>类列表</span></a></li>
      <li><a href="classes.html"><span>类索引</span></a></li>
      <li><a href="hierarchy.html"><span>类继承关系</span></a></li>
      <li><a href="functions.html"><span>类成员</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pro-attribs">Protected 属性</a> &#124;
<a href="class_semaphore-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">Semaphore类 参考<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>信号量抽象类(基于POSIX接口)  
 <a href="class_semaphore.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="_semaphore_8h_source.html">Semaphore.h</a>&gt;</code></p>
<div class="dynheader">
类 Semaphore 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_semaphore.png" usemap="#Semaphore_map" alt=""/>
  <map id="Semaphore_map" name="Semaphore_map">
<area href="class_n_semaphore.html" title="有名信号量,一般用于进程间通信 " alt="NSemaphore" shape="rect" coords="0,56,93,80"/>
<area href="class_u_n_semaphore.html" title="无名信号量,一般用于线程间通信 " alt="UNSemaphore" shape="rect" coords="103,56,196,80"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:ae86f21d900fd315d6938b15f1d2a9104"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae86f21d900fd315d6938b15f1d2a9104"></a>
virtual sint32&#160;</td><td class="memItemRight" valign="bottom"><b>open</b> (sint32 value=1)=0</td></tr>
<tr class="separator:ae86f21d900fd315d6938b15f1d2a9104"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab2a2586eb333ba65704c93dc82a01534"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab2a2586eb333ba65704c93dc82a01534"></a>
virtual sint32&#160;</td><td class="memItemRight" valign="bottom"><b>close</b> ()=0</td></tr>
<tr class="separator:ab2a2586eb333ba65704c93dc82a01534"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acbb526dfd6fa98bc2068652f5a61c661"><td class="memItemLeft" align="right" valign="top">sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_semaphore.html#acbb526dfd6fa98bc2068652f5a61c661">wait</a> ()</td></tr>
<tr class="memdesc:acbb526dfd6fa98bc2068652f5a61c661"><td class="mdescLeft">&#160;</td><td class="mdescRight">等待信号量  <a href="#acbb526dfd6fa98bc2068652f5a61c661">更多...</a><br /></td></tr>
<tr class="separator:acbb526dfd6fa98bc2068652f5a61c661"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7cbb633dbb25fa8c95c2a640a8ed16a2"><td class="memItemLeft" align="right" valign="top">sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_semaphore.html#a7cbb633dbb25fa8c95c2a640a8ed16a2">tryWait</a> ()</td></tr>
<tr class="memdesc:a7cbb633dbb25fa8c95c2a640a8ed16a2"><td class="mdescLeft">&#160;</td><td class="mdescRight">尝试等待信号量  <a href="#a7cbb633dbb25fa8c95c2a640a8ed16a2">更多...</a><br /></td></tr>
<tr class="separator:a7cbb633dbb25fa8c95c2a640a8ed16a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae97c8e0073930baaf3d39259bd87606a"><td class="memItemLeft" align="right" valign="top">sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_semaphore.html#ae97c8e0073930baaf3d39259bd87606a">post</a> ()</td></tr>
<tr class="memdesc:ae97c8e0073930baaf3d39259bd87606a"><td class="mdescLeft">&#160;</td><td class="mdescRight">释放信号量  <a href="#ae97c8e0073930baaf3d39259bd87606a">更多...</a><br /></td></tr>
<tr class="separator:ae97c8e0073930baaf3d39259bd87606a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac02e23031c9521649a5ff7618d03fb93"><td class="memItemLeft" align="right" valign="top">sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_semaphore.html#ac02e23031c9521649a5ff7618d03fb93">getValue</a> (sint32 &amp;value)</td></tr>
<tr class="memdesc:ac02e23031c9521649a5ff7618d03fb93"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取信号量值  <a href="#ac02e23031c9521649a5ff7618d03fb93">更多...</a><br /></td></tr>
<tr class="separator:ac02e23031c9521649a5ff7618d03fb93"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected 属性</h2></td></tr>
<tr class="memitem:a6d28483c923c2aafebed053ccd77d301"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6d28483c923c2aafebed053ccd77d301"></a>
sem_t&#160;</td><td class="memItemRight" valign="bottom"><b>m_sem</b></td></tr>
<tr class="separator:a6d28483c923c2aafebed053ccd77d301"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>信号量抽象类(基于POSIX接口) </p>
</div><h2 class="groupheader">成员函数说明</h2>
<a class="anchor" id="ac02e23031c9521649a5ff7618d03fb93"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sint32 Semaphore::getValue </td>
          <td>(</td>
          <td class="paramtype">sint32 &amp;&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>获取信号量值 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>当前值 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功返回STATUS_OK,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>当value&gt;0说明有资源,=0无资源,&lt;0表示有|value|个线程在等待资源 </dd></dl>

</div>
</div>
<a class="anchor" id="ae97c8e0073930baaf3d39259bd87606a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sint32 Semaphore::post </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>释放信号量 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">void</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功返回STATUS_OK,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>使信号量值增加1,释放资源 </dd></dl>

</div>
</div>
<a class="anchor" id="a7cbb633dbb25fa8c95c2a640a8ed16a2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sint32 Semaphore::tryWait </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>尝试等待信号量 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">void</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功返回STATUS_OK,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>使信号量值减1,如果无资源可申请,则返回. </dd></dl>

</div>
</div>
<a class="anchor" id="acbb526dfd6fa98bc2068652f5a61c661"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sint32 Semaphore::wait </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>等待信号量 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">void</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功返回STATUS_OK,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>使信号量值减1,如果无资源可申请,则阻塞. </dd></dl>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>libemb/inc/<a class="el" href="_semaphore_8h_source.html">Semaphore.h</a></li>
<li>libemb/src/Semaphore.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
生成于 2016年 七月 7日 星期四 19:49:39 , 为 embedme使用  &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>
